package oj_qmfx.oj_12;



class Node{
    int data;
    Node next;

    public Node(int data) {
        this.data = data;
        this.next = null;
    }

}

class LinkStack{
    private Node top;

    public LinkStack() {
        top = null;
    }

    public boolean isEmpty(){
        return top == null;
    }

    public void push(int x ){
        Node newNode = new Node(x);
        newNode.next = top;
        top = newNode;
    }

    public int pop(){
        if (isEmpty()){
            return -1;
        }
        int x = top.data;
        top = top.next;
        return x;
    }

    public int getTop(){
        if (isEmpty()){
            return -1;
        }
        return top.data;
    }


}



public class Main {
    public static void main(String[] args) {

    }
}
